#!/bin/bash
NET=172.20.2
USER=fsadmin
OLD_PW=ehualu@1234
NEW_PW=dlsjh@2023



for i in $(seq 4 13);do
{
/usr/bin/expect <<-EOF
	spawn ssh ${USER}@${NET}.$i
	expect {
		"yes/no" {send "yes\r";exp_continue}
		"*assword:" {send "${OLD_PW}\r"}

	}
	expect "Current*password:"
	send "${OLD_PW}\r"

	expect "New*password:"
	send "${NEW_PW}\r"
	expect "Retype*password:"
	send "${NEW_PW}\r"
	expect eof
	EOF
}
done